Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html lang="en"> <head> <script src= "../../ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> </head> <body> <div ng-app="" ng-controller="formController"> <form novalidate> First Name:<br> <input type="text" ng-model="user.firstName"><br> Last Name:<br> <input type="text" ng-model="user.lastName"> <br><br> <button ng-click="reset()">RESET</button> </form> <p>form = {{user }}</p> <p>master = {{master}}</p> </div> <script> function formController ($scope) { $scope.master = {firstName:"John", lastName:"Doe"}; $scope.reset = function() { $scope.user = angular.copy($scope.master); }; $scope.reset(); } </script> </body> <!-- Mirrored from www.w3schools.com/angular/tryit.asp?filename=try_ng_form by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:30:49 GMT --> </html>
Result:
Try it Yourself - © w3schools.com